package com.dy.cloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述) @EnableCircuitBreaker:服务降级注解，需要开启
 * @Date: 2021/9/15 13:20
 * @Version 1.0 (版本)
 */
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
public class CloudProviderPaymentHystrix8001 {
    public static void main(String[] args) {
        SpringApplication.run(CloudProviderPaymentHystrix8001.class, args);
    }
    /**
     * HystrixDashboard的测试，
     * @return
     **/
    @Bean
    public ServletRegistrationBean e(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        servletRegistrationBean.addUrlMappings("/actuator/hystrix.stream");
        return servletRegistrationBean;
    }
}
